package com.arlin.springcloud.config;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @ClassName: BeanConfig
 * @Description: TODO
 * @Author: arlin
 * @Date: 2021/3/21
 */
//springboot中的@Configuration注解，相当于spring中的applicationContext.xml
@Configuration
public class BeanConfig {

    @Bean
    @LoadBalanced   //负载均衡
    public RestTemplate getRestTemplate() {
        return new RestTemplate();
    }
}
